Skip to content

Conversation

@erwango
Copy link
Member

@erwango erwango commented Oct 21, 2025

Based on #97037

Similarly to what is done for stm32h750_dk board in #97037, introduce a ext_flash_app board variant aiming at being chainloaded by MCUBoot.
Requires mcuboot counter part (mcu-tools/mcuboot#2510) to allow MCUBoot to run on internal flash.

Doc not provided, waiting for #97037 to be merged.
@JarmouniA, in a fisrst step, I plan to redirect doc to stm32h750_dk to avoid redundant doc in each board.

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
mcuboot zephyrproject-rtos/mcuboot@b192716 (main) zephyrproject-rtos/mcuboot@96576b3 (upstream-sync) zephyrproject-rtos/[email protected]

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

compatible = "soc-nv-flash";
reg = <0x0 DT_SIZE_M(128)>;
write-block-size = <1>;
erase-block-size = <DT_SIZE_K(128)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
erase-block-size = <DT_SIZE_K(128)>;
erase-block-size = <DT_SIZE_K(4)>;

lowest as possible, see #97037 (comment)

Comment on lines 14 to 16
choice MCUBOOT_MODE
default MCUBOOT_MODE_DIRECT_XIP
endchoice
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also use MCUBOOT_MODE_SWAP_USING_OFFSET like in #97037 ?

Copy link
Member Author

@erwango erwango Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, MCUBOOT_MODE_SWAP_USING_OFFSET prevents building mcuboot image as it has an impact on following parameters (build/stm32h7s78_dk/stm32h7s7xx/ext_app_flash/mcubootCMakeCache.txt)

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=32808
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=32768

vs (SINGLE_APP_MODE & DIRECT_XIP)

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=88
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=48

As a consequence, this doesn't fit available RAM anymore.
Note that it is the same on stm32h750_dk because it can afford it:

Memory region         Used Size  Region Size  %age Used
           FLASH:       34568 B       128 KB     26.37%
             RAM:      138304 B       512 KB     26.38%

but also trailers size are lower:

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=16424
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=16384

(Anyway, in any case, this wouldn't fit on stm32h7s78_dk which has only 128k of RAM)

I'll go for SINGLE_APP_MODE for now, but there is probably something to investigate here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ammount of sectors in slot0 and slot1 has a direct influence in mcuboot size, as it uses that for the size of an array. would propably work, if we make the flash driver respect the value from the dt prop erase-block-size, so it can be used to increase it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that's for later

Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other MCUboot tests the board can be added to (see the H750B-DK PR).

reg = <0x70000000 DT_SIZE_M(64)>;
zephyr,memory-region = "EXTMEM";
/* The ATTR_MPU_EXTMEM attribut causing a MPU FAULT */
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_IO)>;
Copy link
Contributor

@JarmouniA JarmouniA Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test samples/modules/lvgl/demos? On H750B-DK, it didn't work with MPU_IO (but worked with MPU_FLASH). On H573I-DK it did work (& with MPU_FLASH the board didn't boot), not sure why yet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Display related features are not working yet when executed from external flash. Probably due to STM32_LTDC_FB_USE_SHARED_MULTI_HEAP, had no time to investigate this (likely related to use of multiple XSPI instances used in //)

Is everyone fine to put this as a notable issue that can still be investigated and fixed in RC ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Display related features are not working yet

Weird, even samples/drivers/display?

Non-blocking, but could you try with MPU_FLASH attribute?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is everyone fine to put this as a notable issue that can still be investigated and fixed in RC ?

Makes sense.

@erwango erwango dismissed stale reviews from JarmouniA and maass-hamburg via 2b3c1b3 October 24, 2025 08:42
@erwango erwango force-pushed the dev_h7dk_ext_app_flash branch 2 times, most recently from 34a08eb to 4c675de Compare October 24, 2025 08:51
nordicjm
nordicjm previously approved these changes Oct 24, 2025
west.yml Outdated
url-base: https://github.com/zephyrproject-rtos
- name: babblesim
url-base: https://github.com/BabbleSim
- name: mcuboot_upstream
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to use proper commit for this, ping me when one is needed and will prepare it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nordicjm Don't you need to approve & merge mcu-tools/mcuboot#2510 first ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm github does not seem to be working for me using git right now, will have a look later and see if it starts working

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems it does eventually work, use the commit from here: https://github.com/nordicjm/zephyr/tree/somemcubootupdatecommits

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, let me know if this is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm no, cherry pick the commit above and replace your commit with it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nordicjm Hope it is fine now

endchoice

choice MCUBOOT_MODE
default MCUBOOT_MODE_SINGLE_APP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can use direct-xip if wanted, there is no limitation on mode that can be used

@erwango erwango requested a review from etienne-lms October 24, 2025 09:10
Update Zephyr fork of MCUboot to revision:
  96576b341ee19f1c3af6622256b0d4f3d408e1e3

Brings following Zephyr relevant fixes:

  - 96576b34 boot: zephyr: socs: stm32h7s7xx: Add support for
    ext_flash_app variant
  - 56538cf6 bootutil: Move update-independent code
  - fccd8905 loader: Move boot_get_max_app_size(..) API
  - 0248a023 bootutil: Move state-independent area APIs
  - f2d3f00a loader: Unify image check API.
  - dcc66e51 loader: Unify header_valid(..) API
  - 257265c8 loader: Optimize boot_check_header_erased(..)
  - 76e56e4f loader: Rename boot_version_cmp
  - 5311589b loader: Fix compile-time issues in loader.c
  - 606a1934 boot: zephyr: socs: add overlay & conf for
    stm32h573xx_ext_flash_app
  - 521fc0bf bootutil: Conditionally include mbedtls/ oid.h,
    asn1.h
  - 71b41e38 boot: zephyr: boards: remove nrf54h20dk overlay
  - 2fc1bd84 bootutil: Drop slot number and boot_state from most
    boot_enc functions
  - 1dd8ae60 boot: zephyr: rework stm32h750b_dk board overlay &
    conf

Signed-off-by: Jamie McCrae <[email protected]>
@erwango erwango force-pushed the dev_h7dk_ext_app_flash branch from 4c675de to 0669808 Compare October 24, 2025 09:53
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Oct 24, 2025
Add ext_flash_app variant to stm32h7s78_dk to allow building
application running on ext flash.

Largely based on A.Jarmouni's work to enable the same on stm32h750_dk
in PR 97037.

Signed-off-by: Erwan Gouriou <[email protected]>
…iant

Now that ext_flash_app variant is available, it should be used for
mcuboot related apps on this board.

Signed-off-by: Erwan Gouriou <[email protected]>
Add debug using stlink gdbserver as an alternative to pyocd.

Signed-off-by: Erwan Gouriou <[email protected]>
Actual available internal RAM size was wrong, fix it.

Signed-off-by: Erwan Gouriou <[email protected]>
@erwango erwango force-pushed the dev_h7dk_ext_app_flash branch from 0669808 to 1e20348 Compare October 24, 2025 12:01
@maass-hamburg maass-hamburg added this to the v4.3.0 milestone Oct 24, 2025
Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sonarqubecloud
Copy link

@maass-hamburg maass-hamburg assigned erwango and unassigned tejlmand Oct 24, 2025
@erwango erwango assigned etienne-lms and unassigned erwango Oct 24, 2025
@cfriedt cfriedt merged commit e532f6a into zephyrproject-rtos:main Oct 24, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants